﻿#region Namespace imports

using System;

#endregion

namespace AdventureGame
{
    internal class Rewards
    {
        private Random rand1 = new Random();

        public static void Treasure(String monster)
        {
            if (monster == "troll")
            {
                TrollTreasure();
            }
            else if (monster == "troll group")
            {
                TrollGroupTreasure();
            }
            else if (monster == "witch")
            {
                WitchTreasure();
            }
        }

        private static void TrollTreasure()
        {
            Random rand = new Random();
            Int32 random = rand.Next(10);
            if (random >= 5)
            {
                Int32 random1 = rand.Next(10);
                if (random1 <= 3)
                {
                    Int32 random3 = rand.Next(3);
                    Hero.SetAtk(random3);
                    Console.WriteLine("You found a great sword!");
                    Console.WriteLine("Your atk went up by {0}", random3);
                }
                else if (random1 >= 4 && random1 <= 6)
                {
                    Int32 random3 = rand.Next(3);
                    Hero.SetDef(random3);
                    Console.WriteLine("You found a suit of chain mail!");
                    Console.WriteLine("Your def went up by {0}", random3);
                }
                else if (random1 >= 7 && random1 <= 8)
                {
                    Int32 random3 = rand.Next(3);
                    Hero.SetPot(random3);
                    if (random3 == 1)
                    {
                        Console.WriteLine("You found a potion!");
                    }
                    else
                    {
                        Console.WriteLine("You found {0} potions!", random3);
                    }
                }
                else if (random1 == 9)
                {
                    Int32 random3 = rand.Next(3);
                    Hero.SetManaPot(random3);
                    if (random3 == 1)
                    {
                        Console.WriteLine("You found a mana potion!");
                    }
                    else
                    {
                        Console.WriteLine("You found {0} mana potions!", random3);
                    }
                }
                else if (random1 >= 10)
                {
                    Int32 random3 = rand.Next(20);
                    Hero.SetAtk(random3);
                    Console.WriteLine(
                        "You found the Ultima Weapon, also known as Excalibur and the Sword of the Gods!!!");
                    Console.WriteLine("Your atk went up by {0}", random3);
                }
            }
        }

        private static void WitchTreasure()
        {
            Random rand = new Random();
            Int32 random = rand.Next(10);
            if (random >= 3)
            {
                Int32 random1 = rand.Next(10);
                if (random1 <= 3)
                {
                    Int32 random3 = rand.Next(7);
                    Hero.SetAtk(random3);
                    Console.WriteLine("You found a mighty magic sword!");
                    Console.WriteLine("Your atk went up by {0}", random3);
                }
                else if (random1 >= 4 && random1 <= 6)
                {
                    Int32 random3 = rand.Next(7);
                    Hero.SetDef(random3);
                    Console.WriteLine("You found a suit of half plate!");
                    Console.WriteLine("Your def went up by {0}", random3);
                }
                else if (random1 >= 7 && random1 <= 8)
                {
                    Int32 random3 = rand.Next(7);
                    Hero.SetPot(random3);
                    if (random3 == 1)
                    {
                        Console.WriteLine("You found a potion!");
                    }
                    else
                    {
                        Console.WriteLine("You found {0} potions!", random3);
                    }
                }
                else if (random1 == 9)
                {
                    Int32 random3 = rand.Next(7);
                    Hero.SetManaPot(random3);
                    if (random3 == 1)
                    {
                        Console.WriteLine("You found a mana potion!");
                    }
                    else
                    {
                        Console.WriteLine("You found {0} mana potions!", random3);
                    }
                }
                else if (random1 >= 10)
                {
                    Int32 random3 = rand.Next(20);
                    Hero.SetAtk(random3);
                    Console.WriteLine(
                        "You found the Ultima Weapon, also known as Excalibur and the Sword of the Gods!!!");
                    Console.WriteLine("Your atk went up by {0}", random3);
                }
            }
        }

        private static void TrollGroupTreasure()
        {
            Random rand = new Random();
            Int32 random = rand.Next(10);
            if (random >= 3)
            {
                Int32 random1 = rand.Next(10);
                if (random1 <= 3)
                {
                    Int32 random3 = rand.Next(5);
                    Hero.SetAtk(random3);
                    Console.WriteLine("You found a magic sword!");
                    Console.WriteLine("Your atk went up by {0}", random3);
                }
                else if (random1 >= 4 && random1 <= 6)
                {
                    Int32 random3 = rand.Next(5);
                    Hero.SetDef(random3);
                    Console.WriteLine("You found a suit of half plate!");
                    Console.WriteLine("Your def went up by {0}", random3);
                }
                else if (random1 >= 7 && random1 <= 8)
                {
                    Int32 random3 = rand.Next(5);
                    Hero.SetPot(random3);
                    if (random3 == 1)
                    {
                        Console.WriteLine("You found a potion!");
                    }
                    else
                    {
                        Console.WriteLine("You found {0} potions!", random3);
                    }
                }
                else if (random1 == 9)
                {
                    Int32 random3 = rand.Next(5);
                    Hero.SetManaPot(random3);
                    if (random3 == 1)
                    {
                        Console.WriteLine("You found a mana potion!");
                    }
                    else
                    {
                        Console.WriteLine("You found {0} mana potions!", random3);
                    }
                }
                else if (random1 >= 10)
                {
                    Int32 random3 = rand.Next(20);
                    Hero.SetAtk(random3);
                    Console.WriteLine(
                        "You found the Ultima Weapon, also known as Excalibur and the Sword of the Gods!!!");
                    Console.WriteLine("Your atk went up by {0}", random3);
                }
            }
        }
    }
}